package org.lex.dbq.model.jdbc.resultset;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SQLResultSet implements IResultSetFactory {
	protected final Connection conn;
	protected final String sql;

	private Statement stat = null;

	public SQLResultSet(Connection md, String sql) {
		this.conn = md;
		this.sql = sql;
	}

	@Override
	public ResultSet execute() throws SQLException {
		// FIXME
		stat = conn.createStatement();
		stat.execute(sql);
		ResultSet rs = stat.getResultSet();
		return rs;
	}

	@Override
	public boolean hasMoreResults() throws SQLException {
		// FIXME
		return null == stat ? false : stat.getMoreResults();
	}

}
